package com.cqupt.scanning.system.statistics.controller;

import com.cqupt.scanning.system.file.helper.FilePathConfig;
import com.cqupt.scanning.system.statistics.service.CalculatedDataThreeService;
import com.cqupt.scanning.system.statistics.service.StatisticsService;
import com.cqupt.scanning.system.utils.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Data: 2021/7/8 16:01
 * @Author: 宋宝梁
 */
@RestController
@RequestMapping("/admin/statistics")
public class StatisticsController {

    @Autowired
    private StatisticsService statisticsService;
    @Autowired
    private CalculatedDataThreeService calculatedDataThreeService;


    /**
     * 获取设备数量（区分足底扫描和三维扫描）
     * @return
     */
    @GetMapping("/dev/count")
    public R queryDevCount() {
        return statisticsService.queryDevCount();
    }

    /**
     * 获取病人数量（区分足底扫描和三维扫描）
     * @return
     */
    @GetMapping("/pat/count")
    public R queryPatCount() {
        return statisticsService.queryPatCount();
    }

    /**
     * 获取申请医生数量(考虑为:等于足底、三维病人数量)
     * @return
     */
    @GetMapping("/appDoc/count")
    public R queryAppDoctorCount() {
        return statisticsService.queryAppDoctorCount();
    }

    /**
     * 获取检测医生数量（考虑为：等于足底、三维病人数量）
     * @return
     */
    @GetMapping("/detDoc/count")
    public R queryDetectDoctorCount() {
        return statisticsService.queryDetectDoctorCount();
    }

    /**
     * 获取报告数量（考虑为：等于足底、三维病人数量）
     * @return
     */
    @GetMapping("/report/count")
    public R queryReportCount() {
        return statisticsService.queryReportCount();
    }

    /**
     * 获取excel（步态分析和平衡测试）
     * @return
     */
    @GetMapping("/excel/count")
    @ResponseBody
    public R queryExcelCount(@RequestParam(value = "name",required = false) String name,
                             @RequestParam(value = "age_lower",required = false) String ageLower,
                             @RequestParam(value = "age_upper",required = false) String ageUpper,
                             @RequestParam(value = "doctor",required = false) String doctor,
                             @RequestParam(value = "height_lower",required = false) String heightLower,
                             @RequestParam(value = "height_upper",required = false) String heightUpper,
                             @RequestParam(value = "measureMode",required = false) String measureMode,
                             @RequestParam(value = "sex",required = false) String sex,
                             @RequestParam(value = "weight_lower",required = false) String weightLower,
                             @RequestParam(value = "weight_upper",required = false) String weightUpper,
                             @RequestParam(value = "orgName",required = false) String orgName,
                             @RequestParam(value = "beginTime",required = false) String beginTime,
                             @RequestParam(value = "endTime",required = false) String endTime,
                             @RequestParam(value = "username",required = false) String userName,
                             @RequestParam(value = "phone",required = false) String phone) {
        return statisticsService.queryExcelCount(name, ageLower, ageUpper, doctor, heightLower, heightUpper, measureMode, sex, weightLower, weightUpper, beginTime, endTime,userName,phone,orgName);
    }

    /**
     * 获取excel（三维扫描）
     * @return
     */
    @GetMapping("/threeExcel/count")
    @ResponseBody
    public R queryThreeExcelCount(
            @RequestParam(value = "username",required = false) String userName,
            @RequestParam(value = "name",required = false) String name,
            @RequestParam(value = "sex",required = false) String sex,
            @RequestParam(value = "business_name",required = false) String businessName,
            @RequestParam(value = "address",required = false) String address,
            @RequestParam(value = "city_province",required = false) String cityProvince,
            @RequestParam(value = "country",required = false) String country,
            @RequestParam(value = "phone",required = false) String phone,
            @RequestParam(value = "fax",required = false) String fax,
            @RequestParam(value = "age",required = false) String age,
            @RequestParam(value = "age_lower",required = false) String ageLower,
            @RequestParam(value = "age_upper",required = false) String ageUpper,
            @RequestParam(value = "height_lower",required = false) String heightLower,
            @RequestParam(value = "height_upper",required = false) String heightUpper,
            @RequestParam(value = "weight_lower",required = false) String weightLower,
            @RequestParam(value = "weight_upper",required = false) String weightUpper,
            @RequestParam(value = "weight_bearing_lower",required = false) String weightBearingLower,
            @RequestParam(value = "weight_bearing_upper",required = false) String weightBearingUpper,
            @RequestParam(value = "dress_shoe",required = false) String dressShoe,
            @RequestParam(value = "athletic_shoe",required = false) String athleticShoe,
            @RequestParam(value = "casual_shoe",required = false) String casualShoe,
            @RequestParam(value = "heels",required = false) String heels,
            @RequestParam(value = "beginTime",required = false) String beginTime,
            @RequestParam(value = "endTime",required = false) String endTime,
            @RequestParam(value = "doctor",required = false) String doctor,
            @RequestParam(value = "measureMode",required = false) String measureMode) {
        return statisticsService.queryThreeExcelCount(name, ageLower, ageUpper, doctor, heightLower, heightUpper, measureMode, sex, weightLower, weightUpper, beginTime, endTime,userName,phone,businessName,address,cityProvince,country,fax,
                weightBearingLower, weightBearingUpper,dressShoe,athleticShoe,casualShoe,heels,age);
    }

}
